package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

/**
 *转换流：InputStreamReader和OutputStreamWriter,它们继承自Reader和Writer
 *
 */

public class OSWDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos=new FileOutputStream("osw.txt");
        OutputStreamWriter osw=new OutputStreamWriter(fos, StandardCharsets.UTF_8);//创建转换流时，通常会指明第二个参数的字符集，保证跨平台性
        osw.write("和你走在城都的街头，哦哦哦");
        osw.write("直到所有灯熄灭也不停留");
        System.out.println("写出完毕");
        osw.close();

    }
}
